﻿#pragma strict

@MenuItem("Level4/Ragdoll/Cleanup")
static function Init(){
	var tr:Transform = Selection.activeTransform;
	if(tr){
		if(EditorUtility.DisplayDialog("注意","确定删除ragdoll信息?","ok","cancel")){
			var bodys:Rigidbody[] = tr.GetComponentsInChildren.<Rigidbody>();
			var colliders:Collider[] = tr.GetComponentsInChildren.<Collider>();
			var joints:Joint[] = tr.GetComponentsInChildren.<Joint>();
			
			for(var j:Joint in joints){
				DestroyImmediate(j);
			}
			for(var body:Rigidbody in bodys){
				DestroyImmediate(body);
			}
			for(var c:Collider in colliders){
				DestroyImmediate(c);
			}
		}
	}
}